<?php

namespace app\api\controller;

use app\BaseController;//测试专用
use think\facade\Db;
use  app\common\controller\DBase;
use app\api\logic\ApiProductLogic;
use Throwable;

class ApiProduct extends DBase
{
    /**
     * 模型
     * @var object
     * @phpstan-var ApiAdvaccountModel
     */

    public function initialize(): void
    {
        parent::initialize();
    }

    /**
     * 获取list
     * @throws Throwable
     */
    public function ApiProductList()
    {
        $params     = $this->request->get();
        $ApiProductLogic = new ApiProductLogic();
        return $ApiProductLogic->ApiProductList($params);
    }
    /**
     * 获取list
     * @throws Throwable
     */
    public function ApiProductInfo()
    {
        $params     = $this->request->get();
        $ApiProductLogic = new ApiProductLogic();
        return $ApiProductLogic->ApiProductInfo($params);
    }

    /**
     * 产品刊登
     * @throws Throwable
     */
    public function ApiProductAdd()
    {
        $params     = $this->request->post();
        $ApiProductLogic = new ApiProductLogic();
        return $ApiProductLogic->ApiProductAdd($params);
    }
    
    /**
     * 产品修改
     * @throws Throwable
     */
    public function ApiProductEdit()
    {
        $params     = $this->request->post();
        $ApiProductLogic = new ApiProductLogic();
        return $ApiProductLogic->ApiProductEdit($params);
    }
    
    /**
     * 产品删除
     * @throws Throwable
     */
    public function ApiProductDelete()
    {
        $params     = $this->request->post();
        $ApiProductLogic = new ApiProductLogic();
        return $ApiProductLogic->ApiProductDelete($params);
    }
    
    /**
     * 产品系列
     * @throws Throwable
     */
    public function ApiProductCollectionList()
    {
        $params     = $this->request->get();
        $ApiProductLogic = new ApiProductLogic();
        return $ApiProductLogic->ApiProductCollectionList($params);
    }


    /**
     * @desc    获取shopify的token
     * @author  xx
     * @date    2024-12-27
     */
    public function get_shopify_token(){
        $params     = $this->request->post();
        $res    =  (new ApiProductLogic())->get_shopify_token($params);
        return $this->jsonMessage(200, true, "获取成功!", $res);
    }

    /**
     * @desc    产品转移
     */
    public function ApiProductTransfer(){
        $params     = $this->request->get();
        return (new ApiProductLogic())->ApiProductTransfer($params);
    }

    /**
     * @throws Throwable
     */
    public function ApiProductCollectionTransfer()
    {
        $params     = $this->request->get();
        $ApiProductLogic = new ApiProductLogic();
        return $ApiProductLogic->ApiProductCollectionTransfer($params);
    }

}
